Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
jest-resolve
Advanced tools
The jest-resolve package is a module resolver used by Jest, the JavaScript testing framework. It resolves the location of modules in your project, allowing Jest to hook into the module resolution logic. This is particularly useful for mocking modules or creating custom resolution logic for tests.
Resolving modules
This feature allows you to resolve the path to a module within your project. You can specify directories and file extensions to consider during resolution.
const Resolver = require('jest-resolve');
const resolver = new Resolver({}, {
moduleDirectory: ['node_modules'],
extensions: ['.js', '.json', '.jsx', '.ts', '.tsx', '.node']
});
const resolvedPath = resolver.resolveModule('/path/to/project', 'module-name');
Creating a custom resolver
This feature enables you to create a custom resolver function that can be used by Jest to resolve modules according to your specific needs.
const Resolver = require('jest-resolve');
const customResolver = (request, options) => {
// Custom resolution logic here
return Resolver.findNodeModule(request, options);
};
The 'resolve' package is a module resolution library that can be used independently of any test framework. It provides similar functionality to jest-resolve but is not tied to Jest. It's more generic and can be used in a variety of different projects.
This package is used internally by webpack for module resolution. It offers a highly configurable resolution mechanism that can handle complex scenarios like resolving modules based on file system state or package descriptions. It's more powerful than jest-resolve but also more complex to configure.
browser-resolve is a resolver for browser-based modules. It's similar to jest-resolve but focuses on resolving modules in a way that's compatible with the browser environment, taking into account the browser field in package.json files.
29.7.0
[create-jest]
Add npm init
/ yarn create
initialiser for Jest projects (#14465)[jest-validate]
Allow deprecation warnings for unknown options (#14499)[jest-resolver]
Replace unmatched capture groups in moduleNameMapper
with empty string instead of undefined
(#14507)[jest-snapshot]
Allow for strings as well as template literals in inline snapshots (#14465)[@jest/test-sequencer]
Calculate test runtime if perStats.duration
is missing (#14473)[@jest/create-cache-key-function]
Cache access of NODE_ENV
and BABEL_ENV
(#14455)[jest-cli]
Move internal config initialisation logic to the create-jest
package (#14465)FAQs
Unknown package
We found that jest-resolve demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.